package com.tool.weixin.message;

import java.util.List;

import com.tool.weixin.message.type.RespType;
import com.tool.weixin.util.MessageUtil;

/**
 * 图文消息
 * @author huff
 *
 */
public class NewsMessage extends BaseMessage {
	// 图文消息个数，限制为10条以内
	private int ArticleCount;
	// 多条图文消息信息，默认第一个item为大图
	
	private List<ArticleMessage> Articles;
	
	public NewsMessage(List<ArticleMessage> articles) {
		this.Articles = articles;
		if(articles != null) {
			this.ArticleCount = articles.size();
		}
	}
	

	public int getArticleCount() {
		return ArticleCount;
	}

	public void setArticleCount(int articleCount) {
		ArticleCount = articleCount;
	}

	public List<ArticleMessage> getArticles() {
		return Articles;
	}

	public void setArticles(List<ArticleMessage> articles) {
		Articles = articles;
	}
	
	@Override
	public String toxml() {
		if(this.getIsCustomerService()) {
			this.setMsgType(RespType.TRANSFER_CUSTOMER_SERVICE);
		} else {
			this.setMsgType(RespType.NEWS);
		}
		super.toxml();
		return MessageUtil.newsMessageToXml(this);
	}
	
}
